// Filename: pointLight.I
// Created by:  mike (04eb99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University.  All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license.  You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////
//     Function: PointLight::CData::Constructor
//       Access: Public
//  Description:
////////////////////////////////////////////////////////////////////
INLINE PointLight::CData::
CData() :
  _specular_color(1.0f, 1.0f, 1.0f, 1.0f),
  _attenuation(1.0f, 0.0f, 0.0f),
  _point(0.0f, 0.0f, 0.0f)
{
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::CData::Copy Constructor
//       Access: Public
//  Description:
////////////////////////////////////////////////////////////////////
INLINE PointLight::CData::
CData(const PointLight::CData &copy) :
  _specular_color(copy._specular_color),
  _attenuation(copy._attenuation),
  _point(copy._point)
{
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::get_specular_color
//       Access: Public, Final
//  Description: Returns the color of specular highlights generated by
//               the light.
////////////////////////////////////////////////////////////////////
INLINE const LColor &PointLight::
get_specular_color() const {
  CDReader cdata(_cycler);
  return cdata->_specular_color;
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::set_specular_color
//       Access: Public
//  Description: Sets the color of specular highlights generated by
//               the light.
////////////////////////////////////////////////////////////////////
INLINE void PointLight::
set_specular_color(const LColor &color) {
  CDWriter cdata(_cycler);
  cdata->_specular_color = color;
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::get_attenuation
//       Access: Public, Final
//  Description: Returns the terms of the attenuation equation for the
//               light.  These are, in order, the constant, linear,
//               and quadratic terms based on the distance from the
//               point to the vertex.
////////////////////////////////////////////////////////////////////
INLINE const LVecBase3 &PointLight::
get_attenuation() const {
  CDReader cdata(_cycler);
  return cdata->_attenuation;
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::set_attenuation
//       Access: Public
//  Description: Sets the terms of the attenuation equation for the
//               light.  These are, in order, the constant, linear,
//               and quadratic terms based on the distance from the
//               point to the vertex.
////////////////////////////////////////////////////////////////////
INLINE void PointLight::
set_attenuation(const LVecBase3 &attenuation) {
  CDWriter cdata(_cycler);
  cdata->_attenuation = attenuation;
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::get_point
//       Access: Public
//  Description: Returns the point in space at which the light is
//               located.  This is local to the coordinate space in
//               which the light is assigned.
////////////////////////////////////////////////////////////////////
INLINE const LPoint3 &PointLight::
get_point() const {
  CDReader cdata(_cycler);
  return cdata->_point;
}

////////////////////////////////////////////////////////////////////
//     Function: PointLight::set_point
//       Access: Public
//  Description: Sets the point in space at which the light is located.
////////////////////////////////////////////////////////////////////
INLINE void PointLight::
set_point(const LPoint3 &point) {
  CDWriter cdata(_cycler);
  cdata->_point = point;
  mark_viz_stale();
}
